using System;
using System.ComponentModel;
using System.Globalization;

namespace PickGold.Charting
{
	internal class AnchorPointValueConverter : TypeConverter
	{
		public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
		{
			if (destinationType == typeof(string))
			{
				if (value == null)
					return "NotSet";

				var item = value as DataPoint;
				if ((item != null) && (item.series != null))
				{
					var num = item.series.Points.IndexOf(item) + 1;
					return (item.series.Name + " - " + SR.DescriptionTypePoint + num.ToString(CultureInfo.InvariantCulture));
				}
			}
			return base.ConvertTo(context, culture, value, destinationType);
		}
	}
}

